<%--
  Created by IntelliJ IDEA.
  User: wlc
  Date: 2018/9/11
  Time: 15:24
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ include file="PageFrame.jsp"%>
<%@ include file="Markdown-write.jsp"%>

<title>编写文档</title>

<!-- Page Content -->
<div class="container" id="file-write-content">
    <div id="editHead">
        <input type="text" id="textTitle" maxlength="100" value="${userFile.getTitle()}" placeholder="输入文章标题">
        <select id="textType">
            <option>(无)</option>
            <option>计算</option>
            <option>实验</option>
            <option>随访</option>
        </select>
        <button id="textSubmit">发布文章</button>
    </div>
    <div id="editSection"></div>
</div>
<input type="text" id="hidden-fileId">
<!-- /Page Content -->

<!-- js-->
<script src="../js/file-write.js" type="text/javascript"></script>
<script type="text/javascript">
    //markdown编辑器
    var content = "${userFile.getContent()}";
    writeEditor = new tui.Editor({
        el: document.querySelector('#editSection'),
        previewStyle: 'vertical',
        initialEditType: 'markdown',
        language: 'zh',
        exts: ['chart', 'table','uml','scrollSync','colorSyntax'],
        initialValue: content
    });
    //set type
    if (!isEmpty("${userFile.getType()}")){
        $('#textType')[0].value = "${userFile.getType()}";
    }
    $('#hidden-fileId')[0].value = "${userFile.getId()}";
</script>
<!-- /js-->
